Obtaining Object References
A job object can reference several format objects. Once you know which format object you want, you can access its properties. QuickDraw GX provides theGXGetFormatJob
function to determine which job object is associated with a particular format object. Even if you know the format's job, you may still want to examine all references to the job's format objects. You can obtain these references with theGXGetJobFormat
function.Listing 2-12 shows an example that uses the
GXGetFormatJob
function to obtain the job object that references a format object and then loops through all the job's format objects using theGXGetJobFormat
function. The example's function, MyGetFormatIndex, returns the format's position, or index value, of the specified format object in the job's list of format objects.Listing 2-12 Using the
GXGetFormatJob
function to obtain a job object
long MyGetFormatIndex(gxFormat myFormat) { gxJob formatsJob; long idx, numFormats; /* Obtain the job object and count of the number of format objects it references. */ formatsJob = GXGetFormatJob(myFormat); numFormats = GXCountJobFormats(formatsJob); /* Compare each of the references to locate the specified format object and return the current format object index. */ for (idx = 1; idx <= numFormats; ++idx) if (myFormat == GXGetJobFormat(formatsJob, idx)) return idx; }
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help